
import java.util.ArrayList;

/**
 *
 * @param <E>
 * @author David COronado
 */

public class CircularListQueueImplementation<E> extends BankQueueImplementation<E> {

    CircularList<E> list;
    
    /**
     *
     */
    public CircularListQueueImplementation()
	{
		num = 0;
		list = new CircularList<E>();
	}

    /**
     *
     * @return the element removed from the queue
     */
    public E remove()
	{
		E tp = list.removeFirst();

		if(tp == null) return null;
		else
		{
			num--;
			return tp;
		}
	}

        /**
         *
         * @return the first element in the queue
         */
        public E peek()
	{
		return list.getHead();
	}

        /**
         *
         * @param q ; element added to the queue
         */
        public void add(E q)
	{
		list.addLast(q);
		num++;
	}

        /**
         *
         * @return the size of the queue
         */
        public int size()
	{
		return num;
	}
}
